package com.tech.koufu.ui.adapter;

import java.util.ArrayList;

import com.lidroid.xutils.BitmapUtils;
import com.tech.koufu.R;
import com.tech.koufu.model.TrackerUser;
import com.tech.koufu.model.UserGroups;
import com.tech.koufu.ui.adapter.TrackAdapter.ViewHolder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class TeamChangeAdapter extends BaseAdapter{

	private Context context;  
	private LayoutInflater mInflater = null; 
	public ArrayList<UserGroups> datas;

	public TeamChangeAdapter(Context context) {
		this.context = context;
		this.mInflater = LayoutInflater.from(context); 
		datas = new ArrayList<UserGroups>();
	}

	@Override
	public int getCount() {
		if(datas!=null){
			return datas.size();
		}
		return 0;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;  
		//如果缓存convertView为空，则需要创建View  
		if(convertView == null)  
		{  
			holder = new ViewHolder();  
			//根据自定义的Item布局加载布局  
			convertView = mInflater.inflate(R.layout.item_teamchange, parent,false); 
			holder.tv_tc = (TextView)convertView.findViewById(R.id.tv_teamchange);

			//将设置好的布局保存到缓存中，并将其设置在Tag里，以便后面方便取出Tag  
			convertView.setTag(holder);  
		}else  
		{  
			holder = (ViewHolder)convertView.getTag();  
		}  
		final UserGroups ug = datas.get(position);
		holder.tv_tc.setText(ug.name);

		return convertView;
	}

	class ViewHolder{
		TextView tv_tc;
	}
}
